// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IDhcpConfigV6 {
    lease_duration?: number;
    range_start?: string;
}

export default class DhcpConfigV6 {
    readonly _lease_duration: number | undefined;

    get leaseDuration(): number | undefined {
        return this._lease_duration;
    }

    readonly _range_start: string | undefined;

    get rangeStart(): string | undefined {
        return this._range_start;
    }

    constructor(props: IDhcpConfigV6) {
        if (typeof props.lease_duration === 'number') {
            this._lease_duration = props.lease_duration;
        }
        if (typeof props.range_start === 'string') {
            this._range_start = props.range_start.trim();
        }
    }

    serialize(): IDhcpConfigV6 {
        const data: IDhcpConfigV6 = {
        };
        if (typeof this._lease_duration !== 'undefined') {
            data.lease_duration = this._lease_duration;
        }
        if (typeof this._range_start !== 'undefined') {
            data.range_start = this._range_start;
        }
        return data;
    }

    validate(): string[] {
        const validate = {
            range_start: !this._range_start ? true : typeof this._range_start === 'string' && !this._range_start ? true : this._range_start,
            lease_duration: !this._lease_duration ? true : typeof this._lease_duration === 'number',
        };
        const isError: string[] = [];
        Object.keys(validate).forEach((key) => {
            if (!(validate as any)[key]) {
                isError.push(key);
            }
        });
        return isError;
    }

    update(props: Partial<IDhcpConfigV6>): DhcpConfigV6 {
        return new DhcpConfigV6({ ...this.serialize(), ...props });
    }
}
