aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/organization/IssueInfo.java
blob: 4f0b8ac14cf5c075ac525e38cf7508a62df8ded6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.organization;

import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId;
import com.yahoo.vespa.hosted.controller.api.integration.organization.User;

import java.time.Instant;
import java.util.Optional;

/**
 * Information about a stored issue.
 *
 * @author jonmv
 */
public class IssueInfo {

    private final IssueId id;
    private final Instant updated;
    private final Status status;
    private final AccountId assigneeId;

    public IssueInfo(IssueId id, Instant updated, Status status, AccountId assigneeId) {
        this.id = id;
        this.updated = updated;
        this.status = status;
        this.assigneeId = assigneeId;
    }

    public IssueId id() {
        return id;
    }

    public Instant updated() {
        return updated;
    }

    public Status status() {
        return status;
    }

    public Optional<AccountId> assigneeId() {
        return Optional.ofNullable(assigneeId);
    }

    public enum Status {

        toDo("To Do"),
        inProgress("In Progress"),
        done("Done"),
        noCategory("No Category");

        private final String value;

        Status(String value) { this.value = value; }

        public static Status fromValue(String value) {
            for (Status status : Status.values())
                if (status.value.equals(value))
                    return status;
            throw new IllegalArgumentException(value + " is not a valid status.");
        }

    }

}