import { Entity } from '@/core/domain/Entity';
import { Shooting } from './Shooting';

type CustomerProps = {
  lastname: string;
  firstname: string;
  zipcode?: string;
  city?: string;
  address?: string;
  email?: string;
  phone?: string;
  shootings?: Shooting[];
  createdAt: Date;
  updatedAt: Date;
  deleted?: boolean;
  allowDownload: boolean;
};

export class Customer extends Entity<CustomerProps> {
  get lastname() {
    return this.props.lastname;
  }

  get firstname() {
    return this.props.firstname;
  }

  get zipcode() {
    return this.props.zipcode;
  }

  get city() {
    return this.props.city;
  }

  get address() {
    return this.props.address;
  }

  get email() {
    return this.props.email;
  }

  get shootings() {
    return this.props.shootings;
  }

  get phone() {
    return this.props.phone;
  }

  get createdAt() {
    return this.props.createdAt;
  }

  get updatedAt() {
    return this.props.updatedAt;
  }

  get deleted() {
    return this.props.deleted;
  }

  get allowDownload() {
    return this.props.allowDownload;
  }

  set lastname(lastname: string) {
    this.props.lastname = lastname;
  }

  set firstname(firstname: string) {
    this.props.firstname = firstname;
  }

  set zipcode(zipcode: string) {
    this.props.zipcode = zipcode;
  }

  set city(city: string) {
    this.props.city = city;
  }

  set address(address: string) {
    this.props.address = address;
  }

  set email(email: string) {
    this.props.email = email;
  }

  set shootings(shootings: Shooting[]) {
    this.props.shootings = shootings;
  }

  set phone(phone: string) {
    this.props.phone = phone;
  }

  set createdAt(createdAt: Date) {
    this.props.createdAt = createdAt;
  }

  set updatedAt(updatedAt: Date) {
    this.props.updatedAt = updatedAt;
  }

  set deleted(deleted: boolean) {
    this.props.deleted = deleted;
  }

  set allowDownload(allowDownload: boolean) {
    this.props.allowDownload = allowDownload;
  }

  public static create(props: CustomerProps, id?: string) {
    return new Customer(props, id);
  }

  constructor(props: CustomerProps, id?: string) {
    super(props, id);
    this.props.deleted = props.deleted !== undefined ? props.deleted : false;
  }
}
