package uk.gov.dvla.domain;

import com.google.code.morphia.annotations.Embedded;

import java.lang.String;
import java.util.Date;

@Embedded
public class EntitlementRestriction {

    private String code;
    private String text;
    private Date validFrom;
    private Date validTo;
    private String categoryCode;

    public EntitlementRestriction() {
    }

    public EntitlementRestriction(String code, String categoryCode) {
        if (code == null) {
            throw new RuntimeException("code must be specified");
        }
        
        this.code = code;
        this.categoryCode = categoryCode;

    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Date getValidFrom() {
        return validFrom;
    }

    public void setValidFrom(Date validFrom) {
        this.validFrom = validFrom;
    }

    public Date getValidTo() {
        return validTo;
    }

    public void setValidTo(Date validTo) {
        this.validTo = validTo;
    }

    public String getCategoryCode() {
        return categoryCode;
    }

    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }
}

@@ -236,30 +236,35 @@
 private 
-Date validFrom
+String categoryCode
 ;%0A    pr
@@ -286,41 +286,8 @@
 dTo;
-%0A    private String categoryCode;
 %0A%0A  
@@ -852,308 +852,8 @@
  %7D%0A%0A
-    public Date getValidFrom() %7B%0A        return validFrom;%0A    %7D%0A%0A    public void setValidFrom(Date validFrom) %7B%0A        this.validFrom = validFrom;%0A    %7D%0A%0A    public Date getValidTo() %7B%0A        return validTo;%0A    %7D%0A%0A    public void setValidTo(Date validTo) %7B%0A        this.validTo = validTo;%0A    %7D%0A%0A
     
@@ -1024,11 +1024,155 @@
 e;%0A    %7D
+%0A%0A    public Date getValidTo() %7B%0A        return validTo;%0A    %7D%0A%0A    public void setValidTo(Date validTo) %7B%0A        this.validTo = validTo;%0A    %7D
 %0A%7D%0A

Set validTo on Entitlement Restriction and calculated new directivestatus