export interface Bank {
    id: number;
    name: string;
    code?: string | null;
    account_name?: string | null;
    account_number?: string | null;
    is_active?: boolean;
    created_at?: string;
    updated_at?: string;
}

export interface BankFormData {
    name: string;
    code?: string;
    account_name?: string;
    account_number?: string;
    is_active?: boolean;
}

export interface SourceAccount {
    id: number;
    name: string;
    code?: string | null;
    description?: string | null;
    is_active?: boolean;
    created_at?: string;
    updated_at?: string;
}

export interface SourceAccountFormData {
    name: string;
    code?: string;
    description?: string;
    is_active?: boolean;
}

export interface ChartOfAccount {
    id: number;
    parent_id?: number | null;
    code: string;
    name: string;
    description?: string | null;
    type?: 'asset' | 'liability' | 'equity' | 'revenue' | 'expense' | null;
    type_label?: string | null;
    normal_balance?: 'debit' | 'credit' | null;
    normal_balance_label?: string | null;
    is_active?: boolean;
    children?: ChartOfAccount[];
}

export interface ChartOfAccountFormData {
    parent_id?: number | null;
    code: string;
    name: string;
    description?: string;
    type: 'asset' | 'liability' | 'equity' | 'revenue' | 'expense';
    normal_balance: 'debit' | 'credit';
    is_active?: boolean;
}

export const ACCOUNT_TYPES = [
    { value: 'asset', label: 'Asset' },
    { value: 'liability', label: 'Liability' },
    { value: 'equity', label: 'Equity' },
    { value: 'revenue', label: 'Revenue' },
    { value: 'expense', label: 'Expense' },
] as const;

export const NORMAL_BALANCE_TYPES = [
    { value: 'debit', label: 'Debit' },
    { value: 'credit', label: 'Credit' },
] as const;

export interface Budget {
    id: number;
    name: string;
    description?: string | null;
    company_id: number;
    branch_id: number;
    department_id: number;
    coa_id: number;
    source_account_id?: number | null;
    period_year: number;
    period_month?: number | null;
    start_date?: string | null;
    end_date?: string | null;
    allocated_amount: number;
    used_amount?: number;
    remaining_amount?: number;
    usage_percentage?: number;
    period_display?: string;
    company_name?: string;
    branch_name?: string;
    department_name?: string;
    coa_code?: string;
    coa_name?: string;
    is_active?: boolean;
}

export interface BudgetFormData {
    name: string;
    description?: string;
    company_id?: number;
    branch_id?: number;
    department_id?: number;
    coa_id?: number;
    source_account_id?: number | null;
    period_year: number;
    period_month?: number | null;
    start_date?: string;
    end_date?: string;
    allocated_amount: number;
    is_active?: boolean;
}

export interface FundRequestAttachment {
    id: number;
    name: string;
    path?: string;
    url?: string | null;
    created_at?: string;
}

export interface Customer {
    id: number
    uuid: string
    customer_code: string | null
    company_name: string
    company_type: string | null
    legacy_id: number | null
    legacy_kode_nomor: string | null
    lead_prospect_customer_id: number | null
    group_customer_id: number | null
    group_sampling_customer_id: number | null
    business_scale: string | null
    business_unit: string | null
    is_proper: boolean
    company_address: string | null
    document_delivery_address: string | null
    province_id: number | null
    city_id: number | null
    district_id: number | null
    office_phone: string | null
    npwp: string | null
    nama_sesuai_npwp: string | null
    alamat_sesuai_npwp: string | null
    cp_nama: string | null
    cp_telp: string | null
    cp_email: string | null
    cp_nama_keuangan: string | null
    cp_telp_keuangan: string | null
    cp_email_keuangan: string | null
    product: string | null
    area: string | null
    company_note: string | null
    accurate_id: string | null
    accurate_code: string | null
    accurate_customer_no: string | null
    accurate_trans_date: string | null
    accurate_branch_id: number | null
    accurate_branch_name: string | null
    accurate_category_name: string | null
    accurate_currency_code: string | null
    accurate_email: string | null
    accurate_mobile_phone: string | null
    accurate_work_phone: string | null
    accurate_fax: string | null
    accurate_website: string | null
    accurate_npwp_no: string | null
    accurate_pkp_no: string | null
    accurate_wp_name: string | null
    accurate_wp_number: string | null
    accurate_bill_street: string | null
    accurate_bill_city: string | null
    accurate_bill_province: string | null
    accurate_bill_country: string | null
    accurate_bill_zip_code: string | null
    accurate_ship_street: string | null
    accurate_ship_city: string | null
    accurate_ship_province: string | null
    accurate_ship_country: string | null
    accurate_ship_zip_code: string | null
    accurate_default_inc_tax: boolean
    accurate_customer_limit_age: boolean
    accurate_customer_limit_age_value: number | null
    accurate_customer_limit_amount: boolean
    accurate_customer_limit_amount_value: number | null
    accurate_customer_receivable_account_no: string | null
    accurate_customer_down_payment_account_no: string | null
    accurate_sales_account_no: string | null
    accurate_sales_discount_account_no: string | null
    accurate_sales_return_account_no: string | null
    accurate_item_discount_account_no: string | null
    accurate_cogs_account_no: string | null
    accurate_payload?: Record<string, unknown> | null
    virtual_account_code: string | null
    virtual_account_bank_id: number | null
    is_verified: boolean
    verified_at: string | null
    is_active: boolean
    deactivated_at: string | null
    created_at: string
    updated_at: string
}

export interface MasterItem {
    id: number
    uuid: string
    code: string
    name: string
    item_type: string
    description: string | null
    unit: string | null
    is_sellable: boolean
    is_purchasable: boolean
    is_inventoried: boolean
    revenue_account_id: number | null
    cogs_account_id: number | null
    inventory_account_id: number | null
    tax_code: string | null
    accurate_id: string | null
    accurate_code: string | null
    item_id_old: number | null
    is_active: boolean
    deactivated_at: string | null
    created_at: string
    updated_at: string
}
